#
# @lc app=leetcode.cn id=406 lang=python
#
# [406] 根据身高重建队列
#

# @lc code=start
class Solution(object):
    def reconstructQueue(self, people):
        """
        :type people: List[List[int]]
        :rtype: List[List[int]]
        """
        
        people.sort(key=lambda x: (-x[0], x[1]))
        que = []
        for i in range(len(people)):
            que.insert(people[i][1], people[i])
        return que
        
# @lc code=end

